import logging, constants
import character
from world_object import WorldObject
import math
import pygame
import data

class Projectile(WorldObject):
    """Understands an enemy flying across the world"""

    def __init__(self, x=0, y=0, angle=45, speed=1):
        """
        Angle is in degrees
        A speed of 1 corresponds to one step in the vertical or horizontal direction
        """

        WorldObject.__init__(self, x, y, speed=speed, angle=angle)
        self.image = data.load_image('projectile.png', True)
        self.log = logging.getLogger(constants.LOGGER_NAME)
        self.z_index = 8

    def collide(self, obj):
        if hasattr(obj, 'hit'): 
            obj.hit()

    def __str__(self):
        return "projectile %s" % WorldObject.__str__(self)
    

